home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 376-400 / disk_376 / aztecarp / arpbase.h < prev    next >
C/C++ Source or Header  |  1992-05-06  |  48KB  |  1,138 lines

  1. #ifndef    LIBRARIES_ARPBASE_H
  2. #define    LIBRARIES_ARPBASE_H    1
  3.  
  4. /*
  5.  ************************************************************************
  6.  *                                    *
  7.  * 5/3/89    ARPbase.h    by MKSoft from ARPbase.i by SDB        *
  8.  *                                    *
  9.  ************************************************************************
  10.  *                                    *
  11.  *    AmigaDOS Resource Project -- Library Include File        *
  12.  *                     for Lattice C 5.x or Manx C 5.x    *
  13.  *                                    *
  14.  ************************************************************************
  15.  *                                    *
  16.  *    Copyright (c) 1987/1988/1989 by Scott Ballantyne        *
  17.  *                                    *
  18.  *    The arp.library, and related code and files may be freely used    *
  19.  *    by supporters of ARP.  Modules in the arp.library may not be    *
  20.  *    extracted for use in independent code, but you are welcome to    *
  21.  *    provide the arp.library with your work and call on it freely.    *
  22.  *                                    *
  23.  *    You are equally welcome to add new functions, improve the ones    *
  24.  *    within, or suggest additions.                    *
  25.  *                                    *
  26.  *    BCPL programs are not welcome to call on the arp.library.    *
  27.  *    The welcome mat is out to all others.                *
  28.  *                                    *
  29.  ************************************************************************
  30.  *                                    *
  31.  * N O T E !  You MUST! have IoErr() defined as LONG to use LastTracker *
  32.  *          If your compiler has other defines for this, you may wish *
  33.  *          to remove the prototype for IoErr() from this file.    *
  34.  *                                    *
  35.  ************************************************************************
  36.  */
  37.  
  38. /*
  39.  ************************************************************************
  40.  *    First we need to include the Amiga Standard Include files...    *
  41.  ************************************************************************
  42.  */
  43. #ifndef    EXEC_TYPES_H
  44. #include    <exec/types.h>
  45. #endif /* !EXEC_TYPES_H */
  46.  
  47. #ifndef    EXEC_LISTS_H
  48. #include    <exec/lists.h>
  49. #endif /* !EXEC_LISTS_H */
  50.  
  51. #ifndef    EXEC_ALERTS_H
  52. #include    <exec/alerts.h>
  53. #endif /* !EXEC_ALERTS_H */
  54.  
  55. #ifndef    EXEC_LIBRARIES_H
  56. #include    <exec/libraries.h>
  57. #endif  /* !EXEC_LIBRARIES_H */
  58.  
  59. #ifndef    EXEC_SEMAPHORES_H
  60. #include    <exec/semaphores.h>
  61. #endif /* !EXEC_SEMAPHORES_H */
  62.  
  63. #ifndef    LIBRARIES_DOSEXTENS_H
  64. #include    <libraries/dosextens.h>
  65. #endif /* !LIBRARIES_DOSEXTENS_H */
  66.  
  67. /*
  68.  ************************************************************************
  69.  *    Check for MANX/Lattice and define the differences...        *
  70.  ************************************************************************
  71.  *    At the moment MANX 3.6 does not have prototypes or the        *
  72.  *    wonderful #pragma statements of Lattice 5.0...            *
  73.  *    And, no __stdargs in MANX either...                *
  74.  ************************************************************************
  75.  */
  76. #ifdef    AZTEC_C
  77.  
  78. #ifndef __VERSION
  79. #define __VERSION 360
  80. #endif /* __VERSION */
  81.  
  82. #if __VERSION < 500
  83. #define    NO_PRAGMAS    1
  84. #define NO_PROTOTYPES    1
  85. #endif /* __VERSION */
  86.  
  87. #define    C_Args
  88.  
  89. #endif /* AZTEC_C */
  90.  
  91. #ifdef    LATTICE
  92.  
  93. #define    C_Args        __stdargs
  94.  
  95. #endif /* LATTICE */
  96.  
  97. /*
  98.  ************************************************************************
  99.  *    Standard definitions for arp library information        *
  100.  ************************************************************************
  101.  */
  102. #define    ArpName        "arp.library"    /* Name of library... */
  103. #define    ArpVersion    39L        /* Current version... */
  104.  
  105. /*
  106.  ************************************************************************
  107.  *    The current ARP library node...                    *
  108.  ************************************************************************
  109.  */
  110. struct    ArpBase    {
  111.     struct    Library            LibNode;     /* Standard library node        */
  112.         APTR            DosRootNode;     /* Copy of dl_Root            */
  113.         UBYTE            Flags;         /* See bitdefs below            */
  114.         UBYTE            ESCChar;      /* Character to be used for escaping    */
  115.         LONG            ArpReserved1;     /* ArpLib's use only!!            */
  116.     struct    Library            *EnvBase;      /* Dummy library for MANX compatibility*/
  117.     struct    Library            *DosBase;      /* Cached DosBase            */
  118.     struct    Library            *GfxBase;      /* Cached GfxBase            */
  119.     struct    Library            *IntuiBase;     /* Cached IntuitionBase        */
  120.     struct    MinList            ResLists;     /* Resource trackers            */
  121.     struct    ResidentProgramNode    *ResidentPrgList;/* Resident Programs.            */
  122.     struct    SignalSemaphore        ResPrgProtection;/* protection for above        */
  123.         BPTR            SegList;      /* Pointer to loaded libcode (a BPTR).    */
  124.         };
  125.  
  126. /*
  127.  ************************************************************************
  128.  *    The following is here *ONLY* for information and for        *
  129.  *    compatibility with MANX.  DO NOT use in new code!        *
  130.  ************************************************************************
  131.  */
  132. #ifdef    ARP_PRIVATE
  133. struct EnvBase {
  134.     struct    Library    LibNode;    /* Standard library node for linkage    */
  135.         BYTE    *EnvSpace;    /* Access only when Forbidden!        */
  136.         ULONG    EnvSize;    /* Total allocated mem for EnvSpace    */
  137.     struct    ArpBase    *ArpBase;    /* Added in V32 for Resource Tracking    */
  138.         };
  139. #endif
  140.  
  141. /*
  142.  ************************************************************************
  143.  *    These are used in release 33.4 but not by the library code.    *
  144.  *    Instead, individual programs check for these flags.        *
  145.  ************************************************************************
  146.  */
  147. #define    ARPB_WILD_WORLD 0L        ; Mixed BCPL/Normal wildcards.
  148. #define    ARPB_WILD_BCPL  1L        ; Pure BCPL wildcards.
  149.  
  150. #define    ARPF_WILD_WORLD (1L << ARPB_WILD_WORLD)
  151. #define    ARPF_WILD_BCPL  (1L << ARPB_WILD_BCPL)
  152.  
  153. /*
  154.  ************************************************************************
  155.  * The alert object is what you use if you really must return an alert    *
  156.  * to the user. You would normally OR this with another alert number    *
  157.  * from the alerts.h file. Generally, should be NON deadend alerts.    *
  158.  *                                    *
  159.  * For example, if you can't open ArpLibrary:                *
  160.  *    Alert( (AG_OpenLib|AO_ArpLib), 0L);                *
  161.  ************************************************************************
  162.  */
  163. #define    AO_ArpLib    0x00008036L        /* Alert object */
  164.  
  165. /*
  166.  ************************************************************************
  167.  *    Alerts that arp.library may return...                *
  168.  ************************************************************************
  169.  */
  170. #define    AN_ArpLib    0x03600000L    /* Alert number                */
  171. #define    AN_ArpNoMem    0x03610000L    /* No more memory            */
  172. #define    AN_ArpInputMem    0x03610002L    /* No memory for input buffer        */
  173. #define    AN_ArpNoMakeEnv    0x83610003L    /* No memory to make EnvLib        */
  174.  
  175. #define    AN_ArpNoDOS    0x83630001L    /* Can't open dos.library        */
  176. #define    AN_ArpNoGfx    0x83630002L    /* Can't open graphics.library        */
  177. #define    AN_ArpNoIntuit    0x83630003L    /* Can't open intuition            */
  178. #define    AN_BadPackBlues    0x83640000L    /* Bad packet returned to SendPacket()    */
  179. #define    AN_Zombie    0x83600003L    /* Zombie roaming around system        */
  180.  
  181. #define    AN_ArpScattered    0x83600002L    /* Scatter loading not allowed for arp    */
  182.  
  183.  
  184. /*
  185.  ************************************************************************
  186.  *    Return codes you can get from calling ARP Assign()...        *
  187.  ************************************************************************
  188.  */
  189. #define    ASSIGN_OK    0L    /* Everything is cool and groovey            */
  190. #define    ASSIGN_NODEV    1L    /* "Physical" is not valid for assignment        */
  191. #define    ASSIGN_FATAL    2L    /* Something really icky happened            */
  192. #define    ASSIGN_CANCEL    3L    /* Tried to cancel something but it won't cancel    */
  193.  
  194. /*
  195.  ************************************************************************
  196.  *    Size of buffer you need if you are going to call ReadLine()    *
  197.  ************************************************************************
  198.  */
  199. #define    MaxInputBuf    256L
  200.  
  201. /*
  202.  ************************************************************************
  203.  *    The ARP file requester data structure...            *
  204.  ************************************************************************
  205.  */
  206. #ifndef REQLIBRARY_H    /* You know req.library? */
  207.  
  208. struct FileRequester    {
  209.             BYTE    *fr_Hail;        /* Hailing text            */
  210.             BYTE    *fr_File;        /* Filename array (FCHARS + 1)    */
  211.             BYTE    *fr_Dir;        /* Directory array (DSIZE + 1)    */
  212.         struct    Window    *fr_Window;        /* Window requesting or NULL    */
  213.             UBYTE    fr_FuncFlags;        /* Set bitdef's below        */
  214.             UBYTE    fr_Flags2;        /* New flags...            */
  215.             VOID    (*fr_Function)();    /* Your function, see bitdef's    */
  216.             WORD    fr_LeftEdge;        /* To be used later...        */
  217.             WORD    fr_TopEdge;
  218.             };
  219. #endif    /* REQLIBRARY_H */
  220.  
  221. /*
  222.  ************************************************************************
  223.  * The following are the defines for fr_FuncFlags.  These bits tell    *
  224.  * FileRequest() what your fr_UserFunc is expecting, and what        *
  225.  * FileRequest() should call it for.                    *
  226.  *                                    *
  227.  * You are called like so:                        *
  228.  * fr_Function(Mask, Object)                        *
  229.  * ULONG    Mask;                            *
  230.  * CPTR        *Object;                        *
  231.  *                                    *
  232.  * The Mask is a copy of the flag value that caused FileRequest() to    *
  233.  * call your function. You can use this to determine what action you    *
  234.  * need to perform, and exactly what Object is, so you know what to do    *
  235.  * and what to return.                            *
  236.  ************************************************************************
  237.  */
  238. #define    FRB_DoWildFunc    7L /* Call me with a FIB and a name, ZERO return accepts.    */
  239. #define    FRB_DoMsgFunc    6L /* You get all IDCMP messages not for FileRequest()        */
  240. #define    FRB_DoColor    5L /* Set this bit for that new and different look        */
  241. #define    FRB_NewIDCMP    4L /* Force a new IDCMP (only if fr_Window != NULL)        */
  242. #define    FRB_NewWindFunc    3L /* You get to modify the newwindow structure.        */
  243. #define    FRB_AddGadFunc    2L /* You get to add gadgets.                    */
  244. #define    FRB_GEventFunc    1L /* Function to call if one of your gadgets is selected.    */
  245. #define    FRB_ListFunc    0L /* Not implemented yet.                    */
  246.  
  247. #define    FRF_DoWildFunc    (1L << FRB_DoWildFunc)
  248. #define    FRF_DoMsgFunc    (1L << FRB_DoMsgFunc)
  249. #define    FRF_DoColor    (1L << FRB_DoColor)
  250. #define    FRF_NewIDCMP    (1L << FRB_NewIDCMP)
  251. #define    FRF_NewWindFunc    (1L << FRB_NewWindFunc)
  252. #define    FRF_AddGadFunc    (1L << FRB_AddGadFunc)
  253. #define    FRF_GEventFunc    (1L << FRB_GEventFunc)
  254. #define    FRF_ListFunc    (1L << FRB_ListFunc)
  255.  
  256. /*
  257.  ************************************************************************
  258.  * The FR2B_ bits are for fr_Flags2 in the file requester structure    *
  259.  ************************************************************************
  260.  */
  261. #define    FR2B_LongPath    0L /* Specify the fr_Dir buffer is 256 bytes long */
  262.  
  263. #define    FR2F_LongPath    (1L << FR2B_LongPath)
  264.  
  265. /*
  266.  ************************************************************************
  267.  *    The sizes of the different buffers...                *
  268.  ************************************************************************
  269.  */
  270. #ifndef REQLIBRARY_H
  271. #define    FCHARS        32L    /* Filename size                */
  272. #define    DSIZE        33L    /* Directory name size if not FR2B_LongPath    */
  273. #endif
  274.  
  275. #define    LONG_DSIZE    254L    /* If FR2B_LongPath is set, use LONG_DSIZE    */
  276. #define    LONG_FSIZE    126L    /* For compatibility with ARPbase.i        */
  277.  
  278. #define    FR_FIRST_GADGET    0x7680L    /* User gadgetID's must be less than this value    */
  279.  
  280. /*
  281.  ************************************************************************
  282.  * Structure expected by FindFirst()/FindNext()                *
  283.  *                                    *
  284.  * You need to allocate this structure and initialize it as follows:    *
  285.  *                                    *
  286.  * Set ap_BreakBits to the signal bits (CDEF) that you want to take a    *
  287.  * break on, or NULL, if you don't want to convenience the user.    *
  288.  *                                    *
  289.  * if you want to have the FULL PATH NAME of the files you found,    *
  290.  * allocate a buffer at the END of this structure, and put the size of    *
  291.  * it into ap_StrLen.  If you don't want the full path name, make sure    *
  292.  * you set ap_StrLen to zero.  In this case, the name of the file, and    *
  293.  * stats are available in the ap_Info, as per usual.            *
  294.  *                                    *
  295.  * Then call FindFirst() and then afterwards, FindNext() with this    *
  296.  * structure.  You should check the return value each time (see below)    *
  297.  * and take the appropriate action, ultimately calling            *
  298.  * FreeAnchorChain() when there are no more files and you are done.    *
  299.  * You can tell when you are done by checking for the normal AmigaDOS    *
  300.  * return code ERROR_NO_MORE_ENTRIES.                    *
  301.  *                                    *
  302.  * You will also have to check the DirEntryType variable in the ap_Info    *
  303.  * structure to determine what exactly you have received.        *
  304.  ************************************************************************
  305.  */
  306. struct    AnchorPath    {
  307.         struct    AChain        *ap_Base;    /* Pointer to first anchor            */
  308.         struct    AChain        *ap_Last;    /* Pointer to last anchor            */
  309.             LONG        ap_BreakBits;    /* Bits to break on                */
  310.             LONG        ap_FoundBreak;    /* Bits we broke on. Also returns ERROR_BREAK    */
  311.             BYTE        ap_Flags;    /* New use for the extra word...        */
  312.             BYTE        ap_Reserved;    /* To fill it out...                */
  313.             WORD        ap_StrLen;    /* This is what used to be ap_Length        */
  314.         struct    FileInfoBlock    ap_Info;
  315.             BYTE        ap_Buf[1];    /* Allocate a buffer here, if desired        */
  316.             };
  317.  
  318. /*
  319.  ************************************************************************
  320.  *    Bit definitions for the new ap_Flags...                *
  321.  ************************************************************************
  322.  */
  323. #define    APB_DoWild    0L    /* User option ALL                */
  324. #define    APB_ItsWild    1L    /* Set by FindFirst, used by FindNext        */
  325. #define    APB_DoDir    2L    /* Bit is SET if a DIR node should be entered    */
  326.                 /* Application can RESET this bit to AVOID    */
  327.                 /* entering a dir.                */
  328. #define    APB_DidDir    3L    /* Bit is set for an "expired" dir node        */
  329. #define    APB_NoMemErr    4L    /* Set if there was not enough memory        */
  330. #define    APB_DoDot    5L    /* If set, '.' (DOT) will convert to CurrentDir    */
  331.  
  332. #define    APF_DoWild    (1L << APB_DoWild)
  333. #define    APF_ItsWild    (1L << APB_ItsWild)
  334. #define    APF_DoDir    (1L << APB_DoDir)
  335. #define    APF_DidDir    (1L << APB_DidDir)
  336. #define    APF_NoMemErr    (1L << APB_NoMemErr)
  337. #define    APF_DoDot    (1L << APB_DoDot)
  338.  
  339. /*
  340.  ************************************************************************
  341.  * Structure used by the pattern matching functions, no need to obtain,    *
  342.  * diddle or allocate this yourself.                    *
  343.  *                                    *
  344.  * Note:  If you did, you will now break as it has changed...        *
  345.  ************************************************************************
  346.  */
  347. #ifdef    ARP_PRIVATE
  348. struct    AChain    {
  349.     struct    AChain        *an_Child;
  350.     struct    AChain        *an_Parent;
  351.     struct    FileLock    *an_Lock;
  352.     struct    FileInfoBlock    *an_Info;
  353.         BYTE        an_Flags;
  354.         char        an_String[1];    /* Just as is .i file    */
  355.         };                /* ???  Don't use this!    */
  356. #endif
  357.  
  358. #define    DDB_PatternBit    0L
  359. #define    DDB_ExaminedBit    1L
  360. #define    DDB_Completed    2L
  361. #define    DDB_AllBit    3L
  362.  
  363. #define    DDF_PatternBit    (1L << DDB_PatternBit)
  364. #define    DDF_ExaminedBit    (1L << DDB_ExaminedBit)
  365. #define    DDF_Completed    (1L << DDB_Completed)
  366. #define    DDF_AllBit    (1L << DDB_AllBit)
  367.  
  368. /*
  369.  ************************************************************************
  370.  * This structure takes a pointer, and returns FALSE if wildcard was    *
  371.  * not found by FindFirst()                        *
  372.  ************************************************************************
  373.  */
  374. #define    IsWild( ptr )        ( *((LONG *)(ptr)) )
  375.  
  376. /*
  377.  ************************************************************************
  378.  * Constants used by wildcard routines                    *
  379.  *                                    *
  380.  * These are the pre-parsed tokens referred to by pattern match.  It    *
  381.  * is not necessary for you to do anything about these, FindFirst()    *
  382.  * FindNext() handle all these for you.                    *
  383.  ************************************************************************
  384.  */
  385. #define    P_ANY        0x80L    /* Token for '*' | '#?'    */
  386. #define    P_SINGLE    0x81L    /* Token for '?'    */
  387.  
  388. /*
  389.  ************************************************************************
  390.  * No need to muck with these as they may change...            *
  391.  ************************************************************************
  392.  */
  393. #ifdef    ARP_PRIVATE
  394. #define    P_ORSTART    0x82L    /* Token for '('    */
  395. #define    P_ORNEXT    0x83L    /* Token for '|'    */
  396. #define    P_OREND        0x84L    /* Token for ')'    */
  397. #define    P_NOT        0x85L    /* Token for '~'    */
  398. #define    P_NOTCLASS    0x87L    /* Token for '^'    */
  399. #define    P_CLASS        0x88L    /* Token for '[]'    */
  400. #define    P_REPBEG    0x89L    /* Token for '['    */
  401. #define    P_REPEND    0x8AL    /* Token for ']'    */
  402. #endif
  403.  
  404. /*
  405.  ************************************************************************
  406.  * Structure used by AddDANode(), AddDADevs(), FreeDAList().        *
  407.  *                                    *
  408.  * This structure is used to create lists of names, which normally    *
  409.  * are devices, assigns, volumes, files, or directories.        *
  410.  ************************************************************************
  411.  */
  412. struct    DirectoryEntry    {
  413.         struct    DirectoryEntry    *de_Next;    /* Next in list                */
  414.             BYTE        de_Type;    /* DLX_mumble                */
  415.             BYTE        de_Flags;    /* For future expansion, DO NOT USE!    */
  416.             BYTE        de_Name[1];    /* The name of the thing found        */
  417.             };
  418.  
  419. /*
  420.  ************************************************************************
  421.  * Defines you use to get a list of the devices you want to look at.    *
  422.  * For example, to get a list of all directories and volumes, do:    *
  423.  *                                    *
  424.  *    AddDADevs( mydalist, (DLF_DIRS | DLF_VOLUMES) )            *
  425.  *                                    *
  426.  * After this, you can examine the de_type field of the elements added    *
  427.  * to your list (if any) to discover specifics about the objects added.    *
  428.  *                                    *
  429.  * Note that if you want only devices which are also disks, you must    *
  430.  * (DLF_DEVICES | DLF_DISKONLY).                    *
  431.  ************************************************************************
  432.  */
  433. #define    DLB_DEVICES    0L    /* Return devices                */
  434. #define    DLB_DISKONLY    1L    /* Modifier for above: Return disk devices only    */
  435. #define    DLB_VOLUMES    2L    /* Return volumes only                */
  436. #define    DLB_DIRS    3L    /* Return assigned devices only            */
  437.  
  438. #define    DLF_DEVICES    (1L << DLB_DEVICES)
  439. #define    DLF_DISKONLY    (1L << DLB_DISKONLY)
  440. #define    DLF_VOLUMES    (1L << DLB_VOLUMES)
  441. #define    DLF_DIRS    (1L << DLB_DIRS)
  442.  
  443. /*
  444.  ************************************************************************
  445.  * Legal de_Type values, check for these after a call to AddDADevs(),    *
  446.  * or use on your own as the ID values in AddDANode().            *
  447.  ************************************************************************
  448.  */
  449. #define    DLX_FILE    0L    /* AddDADevs() can't determine this    */
  450. #define    DLX_DIR        8L    /* AddDADevs() can't determine this    */
  451. #define    DLX_DEVICE    16L    /* It's a resident device        */
  452.  
  453. #define    DLX_VOLUME    24L    /* Device is a volume            */
  454. #define    DLX_UNMOUNTED    32L    /* Device is not resident        */
  455.  
  456. #define    DLX_ASSIGN    40L    /* Device is a logical assignment    */
  457.  
  458. /*
  459.  ************************************************************************
  460.  *    This macro is to check for an error return from the Atol()    *
  461.  *    routine.  If Errno is ERRBADINT, then there was an error...    *
  462.  *    This was done to try to remain as close to source compatible    *
  463.  *    as possible with the older (rel 1.1) ARPbase.h            *
  464.  ************************************************************************
  465.  */
  466. #define    ERRBADINT    1L
  467. #define    Errno        (IoErr() ? ERRBADINT : 0)
  468.  
  469. /*
  470.  ************************************************************************
  471.  *    Resource Tracking stuff...                    *
  472.  ************************************************************************
  473.  *                                    *
  474.  * There are a few things in arp.library that are only directly        *
  475.  * acessable from assembler.  The glue routines provided by us for    *
  476.  * all 'C' compilers use the following conventions to make these    *
  477.  * available to C programs.  The glue for other language's should use    *
  478.  * as similar a mechanism as possible, so that no matter what language    *
  479.  * or compiler we speak, when talk about arp, we will know what the    *
  480.  * other guy is saying.                            *
  481.  *                                    *
  482.  * Here are the cases:                            *
  483.  *                                    *
  484.  * Tracker calls...                            *
  485.  *        These calls return the Tracker pointer as a secondary    *
  486.  *        result in the register A1.  For C, there is no clean    *
  487.  *        way to return more than one result so the tracker    *
  488.  *        pointer is returned in IoErr().  For ease of use,    *
  489.  *        there is a define that typecasts IoErr() to the correct    *
  490.  *        pointer type.  This is called LastTracker and should    *
  491.  *        be source compatible with the earlier method of storing    *
  492.  *        the secondary result.                    *
  493.  *                                    *
  494.  * GetTracker() -                            *
  495.  *        Syntax is a bit different for C than the assembly call    *
  496.  *        The C syntax is GetTracker(ID).  The binding routines    *
  497.  *        will store the ID into the tracker on return.  Also,    *
  498.  *        in an effort to remain consistant, the tracker will    *
  499.  *        also be stored in LastTracker.                *
  500.  *                                    *
  501.  * In cases where you have allocated a tracker before you have obtained    *
  502.  * a resource (usually the most efficient method), and the resource has    *
  503.  * not been obtained, you will need to clear the tracker id.  The macro    *
  504.  * CLEAR_ID() has been provided for that purpose.  It expects a pointer    *
  505.  * to a DefaultTracker sort of struct.                    *
  506.  ************************************************************************
  507.  */
  508. #define    CLEAR_ID(t)    ((SHORT *) t)[-1]=NULL
  509.  
  510. /*
  511.  ************************************************************************
  512.  * You MUST prototype IoErr() to prevent the possible error in defining    *
  513.  * IoErr() and thus causing LastTracker to give you trash...        *
  514.  *                                    *
  515.  * N O T E !  You MUST! have IoErr() defined as LONG to use LastTracker *
  516.  *          If your compiler has other defines for this, you may wish *
  517.  *          to remove the prototype for IoErr().            *
  518.  ************************************************************************
  519.  */
  520. #define    LastTracker    ((struct DefaultTracker *)IoErr())
  521.  
  522. /*
  523.  ************************************************************************
  524.  * The rl_FirstItem list (ResList) is a list of TrackedResource (below)    *
  525.  * It is very important that nothing in this list depend on the task    *
  526.  * existing at resource freeing time (i.e., RemTask(0L) type stuff,    *
  527.  * DeletePort() and the rest).                        *
  528.  *                                    *
  529.  * The tracking functions return a struct Tracker *Tracker to you, this    *
  530.  * is a pointer to whatever follows the tr_ID variable.            *
  531.  * The default case is reflected below, and you get it if you call    *
  532.  * GetTracker() ( see DefaultTracker below).                *
  533.  *                                    *
  534.  * NOTE: The two user variables mentioned in an earlier version don't    *
  535.  * exist, and never did. Sorry about that (SDB).            *
  536.  *                                    *
  537.  * However, you can still use ArpAlloc() to allocate your own tracking    *
  538.  * nodes and they can be any size or shape you like, as long as the    *
  539.  * base structure is preserved. They will be freed automagically just    *
  540.  * like the default trackers.                        *
  541.  ************************************************************************
  542.  */
  543. struct    TrackedResource    {
  544.         struct    MinNode    tr_Node;    /* Double linked pointer        */
  545.             BYTE    tr_Flags;    /* Don't touch                */
  546.             BYTE    tr_Lock;    /* Don't touch, for Get/FreeAccess()    */
  547.             SHORT    tr_ID;        /* Item's ID                */
  548.  
  549. /*
  550.  ************************************************************************
  551.  * The struct DefaultTracker *Tracker portion of the structure.        *
  552.  * The stuff below this point can conceivably vary, depending        *
  553.  * on user needs, etc.  This reflects the default.            *
  554.  ************************************************************************
  555.  */
  556.             union    {
  557.                 CPTR    tr_Resource;    /* Whatever                */
  558.                     LONG    tg_Verify;    /* For use during TRAK_GENERIC        */
  559.                 }    tr_Object;    /* The thing being tracked        */
  560.             union    {
  561.                 VOID    (*tg_Function)();/* Function to call for TRAK_GENERIC    */
  562.             struct    Window    *tr_Window2;    /* For TRAK_WINDOW            */
  563.                 }    tr_Extra;    /* Only needed sometimes        */
  564.             };
  565.  
  566. #define    tg_Value tg_Verify    /* Ancient compatibility only!  Do NOT use in new CODE!!! */
  567.  
  568. /*
  569.  ************************************************************************
  570.  * You get a pointer to a struct of the following type when you call    *
  571.  * GetTracker().  You can change this, and use ArpAlloc() instead of    *
  572.  * GetTracker() to do tracking. Of course, you have to take a wee bit    *
  573.  * more responsibility if you do, as well as if you use TRAK_GENERIC    *
  574.  * stuff.                                *
  575.  *                                    *
  576.  * TRAK_GENERIC folks need to set up a task function to be called when    *
  577.  * an item is freed.  Some care is required to set this up properly.    *
  578.  *                                    *
  579.  * Some special cases are indicated by the unions below, for        *
  580.  * TRAK_WINDOW, if you have more than one window opened, and don't    *
  581.  * want the IDCMP closed particularly, you need to set a ptr to the    *
  582.  * other window in dt_Window2.  See CloseWindowSafely() for more info.    *
  583.  * If only one window, set this to NULL.                *
  584.  ************************************************************************
  585.  */
  586. struct    DefaultTracker    {
  587.             union    {
  588.                 CPTR    dt_Resource;    /* Whatever                */
  589.                 LONG    tg_Verify;    /* For use during TRAK_GENERIC        */
  590.                 }    dt_Object;    /* The object being tracked        */
  591.             union    {
  592.                 VOID    (*tg_Function)();/* Function to call for TRAK_GENERIC    */
  593.             struct    Window    *dt_Window2;    /* For TRAK_WINDOW            */
  594.                 }    dt_Extra;
  595.             };
  596.  
  597. /*
  598.  ************************************************************************
  599.  *    Items the tracker knows what to do about            *
  600.  ************************************************************************
  601.  */
  602. #define    TRAK_AAMEM    0L    /* Default (ArpAlloc) element        */
  603. #define    TRAK_LOCK    1L    /* File lock                */
  604. #define    TRAK_FILE    2L    /* Opened file                */
  605. #define    TRAK_WINDOW    3L    /* Window -- see docs            */
  606. #define    TRAK_SCREEN    4L    /* Screen                */
  607. #define    TRAK_LIBRARY    5L    /* Opened library            */
  608. #define    TRAK_DAMEM    6L    /* Pointer to DosAllocMem block        */
  609. #define    TRAK_MEMNODE    7L    /* AllocEntry() node            */
  610. #define    TRAK_SEGLIST    8L    /* Program segment            */
  611. #define    TRAK_RESLIST    9L    /* ARP (nested) ResList            */
  612. #define    TRAK_MEM    10L    /* Memory ptr/length            */
  613. #define    TRAK_GENERIC    11L    /* Generic Element, your choice        */
  614. #define    TRAK_DALIST    12L    /* DAlist ( aka file request )        */
  615. #define    TRAK_ANCHOR    13L    /* Anchor chain (pattern matching)    */
  616. #define    TRAK_FREQ    14L    /* FileRequest struct            */
  617. #define    TRAK_FONT    15L    /* GfxBase CloseFont()            */
  618. #define    TRAK_MAX    15L    /* Poof, anything higher is tossed    */
  619.  
  620. #define    TRB_UNLINK    7L    /* Free node bit            */
  621. #define    TRB_RELOC    6L    /* This may be relocated (not used yet)    */
  622. #define    TRB_MOVED    5L    /* Item moved                */
  623.  
  624. #define    TRF_UNLINK    (1L << TRB_UNLINK)
  625. #define    TRF_RELOC    (1L << TRB_RELOC)
  626. #define    TRF_MOVED    (1L << TRB_MOVED)
  627.  
  628. /*
  629.  ************************************************************************
  630.  * Note: ResList MUST be a DosAllocMem'ed list!, this is done for    *
  631.  * you when you call CreateTaskResList(), typically, you won't need    *
  632.  * to access/allocate this structure.                    *
  633.  ************************************************************************
  634.  */
  635. struct    ResList    {
  636.     struct    MinNode        rl_Node;    /* Used by arplib to link reslists    */
  637.     struct    Task        *rl_TaskID;    /* Owner of this list            */
  638.     struct    MinList        rl_FirstItem;    /* List of Tracked Resources        */
  639.     struct    ResList        *rl_Link;    /* SyncRun's use - hide list here    */
  640.         };
  641.  
  642. /*
  643.  ************************************************************************
  644.  *    Returns from CompareLock()                    *
  645.  ************************************************************************
  646.  */
  647. #define    LCK_EQUAL    0L    /* The two locks refer to the same object    */
  648. #define    LCK_VOLUME    1L    /* Locks are on the same volume            */
  649. #define    LCK_DIFVOL1    2L    /* Locks are on different volumes        */
  650. #define    LCK_DIFVOL2    3L    /* Locks are on different volumes        */
  651.  
  652. /*
  653.  ************************************************************************
  654.  *    ASyncRun() stuff...                        *
  655.  ************************************************************************
  656.  * Message sent back on your request by an exiting process.        *
  657.  * You request this by putting the address of your message in        *
  658.  * pcb_LastGasp, and initializing the ReplyPort variable of your    *
  659.  * ZombieMsg to the port you wish the message posted to.        *
  660.  ************************************************************************
  661.  */
  662. struct    ZombieMsg    {
  663.         struct    Message        zm_ExecMessage;
  664.             ULONG        zm_TaskNum;    /* Task ID            */
  665.             LONG        zm_ReturnCode;    /* Process's return code    */
  666.             ULONG        zm_Result2;    /* System return code        */
  667.         struct    DateStamp    zm_ExitTime;    /* Date stamp at time of exit    */
  668.             ULONG        zm_UserInfo;    /* For whatever you wish    */
  669.             };
  670.  
  671. /*
  672.  ************************************************************************
  673.  * Structure required by ASyncRun() -- see docs for more info.        *
  674.  ************************************************************************
  675.  */
  676. struct    ProcessControlBlock    {
  677.                 ULONG        pcb_StackSize;    /* Stacksize for new process            */
  678.                 BYTE        pcb_Pri;    /* Priority of new task                */
  679.                 UBYTE        pcb_Control;    /* Control bits, see defines below        */
  680.                 APTR        pcb_TrapCode;    /* Optional Trap Code                */
  681.                 BPTR        pcb_Input;
  682.                 BPTR        pcb_Output;    /* Optional stdin, stdout            */
  683.                 union    {
  684.                     BPTR    pcb_SplatFile;    /* File to use for Open("*")            */
  685.                     BYTE    *pcb_ConName;    /* CON: filename                */
  686.                     }    pcb_Console;
  687.                 CPTR        pcb_LoadedCode;    /* If not null, will not load/unload code    */
  688.             struct    ZombieMsg    *pcb_LastGasp;    /* ReplyMsg() to be filled in by exit        */
  689.             struct    MsgPort        *pcb_WBProcess;    /* Valid only when PRB_NOCLI            */
  690.                 };
  691.  
  692. /*
  693.  ************************************************************************
  694.  * Formerly needed to pass NULLCMD to a child.  No longer needed.    *
  695.  * It is being kept here for compatibility only...            *
  696.  ************************************************************************
  697.  */
  698. #define    NOCMD    "\n"
  699.  
  700. /*
  701.  ************************************************************************
  702.  * The following control bits determine what ASyncRun() does on        *
  703.  * Abnormal Exits and on background process termination.        *
  704.  ************************************************************************
  705.  */
  706. #define    PRB_SAVEIO    0L    /* Don't free/check file handles on exit    */
  707. #define    PRB_CLOSESPLAT    1L    /* Close Splat file, must request explicitly    */
  708. #define    PRB_NOCLI    2L    /* Don't create a CLI process            */
  709. /*    PRB_INTERACTIVE    3L       This is now obsolete...            */
  710. #define    PRB_CODE    4L    /* Dangerous yet enticing            */
  711. #define    PRB_STDIO    5L    /* Do the stdio thing, splat = CON:Filename     */
  712.  
  713. #define    PRF_SAVEIO    (1L << PRB_SAVEIO)
  714. #define    PRF_CLOSESPLAT    (1L << PRB_CLOSESPLAT)
  715. #define    PRF_NOCLI    (1L << PRB_NOCLI)
  716. #define    PRF_CODE    (1L << PRB_CODE)
  717. #define    PRF_STDIO    (1L << PRB_STDIO)
  718.  
  719. /*
  720.  ************************************************************************
  721.  *    Error returns from SyncRun() and ASyncRun()            *
  722.  ************************************************************************
  723.  */
  724. #define    PR_NOFILE    -1L    /* Could not LoadSeg() the file            */
  725. #define    PR_NOMEM    -2L    /* No memory for something            */
  726. /*    PR_NOCLI    -3L       This is now obsolete                */
  727. #define    PR_NOSLOT    -4L    /* No room in TaskArray                */
  728. #define    PR_NOINPUT    -5L    /* Could not open input file            */
  729. #define    PR_NOOUTPUT    -6L    /* Could not get output file            */
  730. /*    PR_NOLOCK    -7L       This is now obsolete                */
  731. /*    PR_ARGERR    -8L       This is now obsolete                */
  732. /*    PR_NOBCPL    -9L       This is now obsolete                */
  733. /*    PR_BADLIB    -10L       This is now obsolete                */
  734. #define    PR_NOSTDIO    -11L    /* Couldn't get stdio handles            */
  735.  
  736. /*
  737.  ************************************************************************
  738.  *    Added V35 of arp.library                    *
  739.  ************************************************************************
  740.  */
  741. #define    PR_WANTSMESSAGE    -12L    /* Child wants you to report IoErr() to user    */
  742.                 /* for SyncRun() only...            */
  743. #define    PR_NOSHELLPROC    -13L    /* Can't create a shell/cli process        */
  744. #define    PR_NOEXEC    -14L    /* 'E' bit is clear                */
  745. #define    PR_SCRIPT    -15L    /* S and E are set, IoErr() contains directory    */
  746.  
  747. /*
  748.  ************************************************************************
  749.  * Version 35 ASyncRun() allows you to create an independent        *
  750.  * interactive or background Shell/CLI. You need this variant of the    *
  751.  * pcb structure to do it, and you also have new values for nsh_Control,*
  752.  * see below.                                *
  753.  *                                    *
  754.  * Syntax for Interactive shell is:                    *
  755.  *                                    *
  756.  * rc=ASyncRun("Optional Window Name","Optional From File",&NewShell);    *
  757.  *                                    *
  758.  * Syntax for a background shell is:                    *
  759.  *                                    *
  760.  * rc=ASyncRun("Command line",0L,&NewShell);                *
  761.  *                                    *
  762.  * Same syntax for an Execute style call, but you have to be on drugs    *
  763.  * if you want to do that.                        *
  764.  ************************************************************************
  765.  */
  766. struct    NewShell    {
  767.             ULONG    nsh_StackSize;    /* stacksize shell will use for children    */
  768.             BYTE    nsh_Pri;    /* ignored by interactive shells        */
  769.             UBYTE    nsh_Control;    /* bits/values: see above            */
  770.             CPTR    nsh_LogMsg;    /* Optional login message, if null, use default    */
  771.             BPTR    nsh_Input;    /* ignored by interactive shells, but        */
  772.             BPTR    nsh_Output;    /* used by background and execute options.    */
  773.             LONG    nsh_RESERVED[5];
  774.             };
  775.  
  776. /*
  777.  ************************************************************************
  778.  * Bit Values for nsh_Control, you should use them as shown below, or    *
  779.  * just use the actual values indicated.                *
  780.  ************************************************************************
  781.  */
  782. #define    PRB_CLI        0L    /* Do a CLI, not a shell    */
  783. #define    PRB_BACKGROUND    1L    /* Background shell        */
  784. #define    PRB_EXECUTE    2L    /* Do as EXECUTE...        */
  785. #define    PRB_INTERACTIVE    3L    /* Run an interactive shell    */
  786. #define    PRB_FB        7L    /* Alt function bit...        */
  787.  
  788. #define    PRF_CLI        (1L << PRB_CLI)
  789. #define    PRF_BACKGOUND    (1L << PRB_BACKGROUND)
  790. #define    PRF_EXECUTE    (1L << PRB_EXECUTE)
  791. #define    PRF_INTERACTIVE    (1L << PRB_INTERACTIVE)
  792. #define    PRF_FB        (1L << PRB_FB)
  793.  
  794. /*
  795.  ************************************************************************
  796.  *    Common values for sh_Control which allow you to do usefull    *
  797.  *    and somewhat "standard" things...                *
  798.  ************************************************************************
  799.  */
  800. #define    INTERACTIVE_SHELL    (PRF_FB|PRF_INTERACTIVE)        /* Gimme a newshell!        */
  801. #define    INTERACTIVE_CLI        (PRF_FB|PRF_INTERACTIVE|PRF_CLI)    /* Gimme that ol newcli!    */
  802. #define    BACKGROUND_SHELL    (PRF_FB|PRF_BACKGROUND)            /* gimme a background shell    */
  803. #define    EXECUTE_ME        (PRF_FB|PRF_BACKGROUND|PRF_EXECUTE)    /* aptly named, doncha think?    */
  804.  
  805. /*
  806.  ************************************************************************
  807.  *    Additional IoErr() returns added by ARP...            *
  808.  ************************************************************************
  809.  */
  810. #define    ERROR_BUFFER_OVERFLOW    303L    /* User or internal buffer overflow    */
  811. #define    ERROR_BREAK        304L    /* A break character was received    */
  812. #define    ERROR_NOT_EXECUTABLE    305L    /* A file has E bit cleared        */
  813. #define    ERROR_NOT_CLI        400L    /* Program/function neeeds to be cli    */
  814.  
  815. /*
  816.  ************************************************************************
  817.  *    Resident Program Support                    *
  818.  ************************************************************************
  819.  * This is the kind of node allocated for you when you AddResidentPrg()    *
  820.  * a code segment.  They are stored as a single linked list with the    *
  821.  * root in ArpBase.  If you absolutely *must* wander through this list    *
  822.  * instead of using the supplied functions, then you must first obtain    *
  823.  * the semaphore which protects this list, and then release it        *
  824.  * afterwards.  Do not use Forbid() and Permit() to gain exclusive    *
  825.  * access!  Note that the supplied functions handle this locking    *
  826.  * protocol for you.                            *
  827.  ************************************************************************
  828.  */
  829. struct    ResidentProgramNode    {
  830.             struct    ResidentProgramNode    *rpn_Next;    /* next or NULL            */
  831.                 LONG            rpn_Usage;    /* Number of current users    */
  832.                 UWORD            rpn_AccessCnt;    /* Total times used...        */
  833.                 ULONG            rpn_CheckSum;    /* Checksum of code        */
  834.                 BPTR            rpn_Segment;    /* Actual segment        */
  835.                 UWORD            rpn_Flags;    /* See definitions below...    */
  836.                 BYTE            rpn_Name[1];    /* Allocated as needed        */
  837.                 };
  838.  
  839. /*
  840.  ************************************************************************
  841.  *    Bit definitions for rpn_Flags....                *
  842.  ************************************************************************
  843.  */
  844. #define    RPNB_NOCHECK    0L    /* Set in rpn_Flags for no checksumming...    */
  845. #define    RPNB_CACHE    1L    /* Private usage in v1.3...            */
  846.  
  847. #define    RPNF_NOCHECK    (1L << RPNB_NOCHECK)
  848. #define    RPNF_CACHE    (1L << RPNB_CACHE)
  849.  
  850. /*
  851.  ************************************************************************
  852.  * If your program starts with this structure, ASyncRun() and SyncRun()    *
  853.  * will override a users stack request with the value in rpt_StackSize.    *
  854.  * Furthermore, if you are actually attached to the resident list, a    *
  855.  * memory block of size rpt_DataSize will be allocated for you, and    *
  856.  * a pointer to this data passed to you in register A4.  You may use    *
  857.  * this block to clone the data segment of programs, thus resulting in    *
  858.  * one copy of text, but multiple copies of data/bss for each process    *
  859.  * invocation.  If you are resident, your program will start at        *
  860.  * rpt_Instruction, otherwise, it will be launched from the initial    *
  861.  * branch.                                *
  862.  ************************************************************************
  863.  */
  864. struct    ResidentProgramTag    {
  865.                 BPTR    rpt_NextSeg;    /* Provided by DOS at LoadSeg time    */
  866. /*
  867.  ************************************************************************
  868.  * The initial branch destination and rpt_Instruction do not have to be    *
  869.  * the same.  This allows different actions to be taken if you are    *
  870.  * diskloaded or resident.  DataSize memory will be allocated only if    *
  871.  * you are resident, but StackSize will override all user stack        *
  872.  * requests.                                *
  873.  ************************************************************************
  874.  */
  875.                 UWORD    rpt_BRA;    /* Short branch to executable        */
  876.                 UWORD    rpt_Magic;    /* Resident majik value            */
  877.                 ULONG    rpt_StackSize;    /* min stack for this process        */
  878.                 ULONG    rpt_DataSize;    /* Data size to allocate if resident    */
  879.                 /*    rpt_Instruction;    Start here if resident        */
  880.                 };
  881.  
  882. /*
  883.  ************************************************************************
  884.  * The form of the ARP allocated node in your tasks memlist when    *
  885.  * launched as a resident program. Note that the data portion of the    *
  886.  * node will only exist if you have specified a nonzero value for    *
  887.  * rpt_DataSize. Note also that this structure is READ ONLY, modify    *
  888.  * values in this at your own risk.  The stack stuff is for tracking,    *
  889.  * if you need actual addresses or stack size, check the normal places    *
  890.  * for it in your process/task struct.                    *
  891.  ************************************************************************
  892.  */
  893. struct    ProcessMemory    {
  894.         struct    Node    pm_Node;
  895.             UWORD    pm_Num;        /* This is 1 if no data, two if data    */
  896.             CPTR    pm_Stack;
  897.             ULONG    pm_StackSize;
  898.             CPTR    pm_Data;    /* Only here if pm_Num == 2        */
  899.             ULONG    pm_DataSize;
  900.             };
  901.  
  902. /*
  903.  ************************************************************************
  904.  * To find the above on your memlist, search for the following name.    *
  905.  * We guarantee this will be the only arp.library allocated node on    *
  906.  * your memlist with this name.                        *
  907.  * i.e. FindName(task->tcb_MemEntry, PMEM_NAME);            *
  908.  ************************************************************************
  909.  */
  910. #define    PMEM_NAME    "ARP_MEM"
  911.  
  912. #define    RESIDENT_MAGIC    0x4AFC        /* same as RTC_MATCHWORD (trapf) */
  913.  
  914. /*
  915.  ************************************************************************
  916.  *    Date String/Data structures                    *
  917.  ************************************************************************
  918.  */
  919. struct    DateTime    {
  920.         struct    DateStamp    dat_Stamp;    /* DOS Datestamp            */
  921.             UBYTE        dat_Format;    /* controls appearance ot dat_StrDate    */
  922.             UBYTE        dat_Flags;    /* See BITDEF's below            */
  923.             BYTE        *dat_StrDay;    /* day of the week string        */
  924.             BYTE        *dat_StrDate;    /* date string                */
  925.             BYTE        *dat_StrTime;    /* time string                */
  926.             };
  927.  
  928. /*
  929.  ************************************************************************
  930.  *    Size of buffer you need for each DateTime strings:        *
  931.  ************************************************************************
  932.  */
  933. #define    LEN_DATSTRING    10L
  934.  
  935. /*
  936.  ************************************************************************
  937.  *    For dat_Flags                            *
  938.  ************************************************************************
  939.  */
  940. #define    DTB_SUBST    0L    /* Substitute "Today" "Tomorrow" where appropriate    */
  941. #define    DTB_FUTURE    1L    /* Day of the week is in future                */
  942.  
  943. #define    DTF_SUBST    (1L << DTB_SUBST)
  944. #define    DTF_FUTURE    (1L << DTB_FUTURE)
  945.  
  946. /*
  947.  ************************************************************************
  948.  *    For dat_Format                            *
  949.  ************************************************************************
  950.  */
  951. #define    FORMAT_DOS    0L        /* dd-mmm-yy AmigaDOS's own, unique style        */
  952. #define    FORMAT_INT    1L        /* yy-mm-dd International format            */
  953. #define    FORMAT_USA    2L        /* mm-dd-yy The good'ol'USA.                */
  954. #define    FORMAT_CDN    3L        /* dd-mm-yy Our brothers and sisters to the north    */
  955. #define    FORMAT_MAX    FORMAT_CDN    /* Larger than this? Defaults to AmigaDOS        */
  956.  
  957. /*
  958.  ************************************************************************
  959.  * Define NO_PROTOTYPES if your compiler does not handle them...    *
  960.  ************************************************************************
  961.  */
  962. #ifdef    NO_PROTOTYPES
  963. #define    ARGs(x)    ()
  964. #else
  965. #define    ARGs(x)    x
  966. #endif
  967.  
  968. /*
  969.  ************************************************************************
  970.  * Note that C_Args is a #define that, in LATTICE does __stdargs    *
  971.  ************************************************************************
  972.  */
  973.  
  974. /*
  975.  ************************************************************************
  976.  * This prototype is here to prevent the possible error in defining    *
  977.  * IoErr() as LONG and thus causing LastTracker to give you trash...    *
  978.  *                                    *
  979.  * N O T E !  You MUST! have IoErr() defined as LONG to use LastTracker *
  980.  *          If your compiler has other defines for this, you may wish *
  981.  *          to move the prototype for IoErr() into the DO_ARP_COPIES    *
  982.  ************************************************************************
  983.  */
  984.     LONG            IoErr            ARGs(    (VOID)                            );
  985.  
  986. /*
  987.  ************************************************************************
  988.  *    These duplicate the calls in dos.library            *
  989.  *    Only include if you can use arp.library without dos.library    *
  990.  ************************************************************************
  991.  */
  992. #ifdef    DO_ARP_COPIES
  993.     BPTR            Open            ARGs(    (char *, LONG)                        );
  994.     VOID            Close            ARGs(    (BPTR)                            );
  995.     LONG            Read            ARGs(    (BPTR, char *, LONG)                    );
  996.     LONG            Write            ARGs(    (BPTR, char *, LONG)                    );
  997.     BPTR            Input            ARGs(    (VOID)                            );
  998.     BPTR            Output            ARGs(    (VOID)                            );
  999.     LONG            Seek            ARGs(    (BPTR, LONG, LONG)                    );
  1000.     LONG            DeleteFile        ARGs(    (char *)                        );
  1001.     LONG            Rename            ARGs(    (char *, char *)                    );
  1002.     BPTR            Lock            ARGs(    (char *, LONG)                        );
  1003.     VOID            UnLock            ARGs(    (BPTR)                            );
  1004.     BPTR            DupLock            ARGs(    (BPTR)                            );
  1005.     LONG            Examine            ARGs(    (BPTR, struct FileInfoBlock *)                );
  1006.     LONG            ExNext            ARGs(    (BPTR, struct FileInfoBlock *)                );
  1007.     LONG            Info            ARGs(    (BPTR, struct InfoData *)                );
  1008.     BPTR            CreateDir        ARGs(    (char *)                        );
  1009.     BPTR            CurrentDir        ARGs(    (BPTR)                            );
  1010. struct    MsgPort            *CreateProc        ARGs(    (char *, LONG, BPTR, LONG)                );
  1011.     VOID            Exit            ARGs(    (LONG)                            );
  1012.     BPTR            LoadSeg            ARGs(    (char *)                        );
  1013.     VOID            UnLoadSeg        ARGs(    (BPTR)                            );
  1014. struct    MsgPort            *DeviceProc        ARGs(    (char *)                        );
  1015.     LONG            SetComment        ARGs(    (char *, char *)                    );
  1016.     LONG            SetProtection        ARGs(    (char *, LONG)                        );
  1017.     LONG            *DateStamp        ARGs(    (LONG *)                        );
  1018.     VOID            Delay            ARGs(    (LONG)                            );
  1019.     LONG            WaitForChar        ARGs(    (BPTR, LONG)                        );
  1020.     BPTR            ParentDir        ARGs(    (BPTR)                            );
  1021.     LONG            IsInteractive        ARGs(    (BPTR)                            );
  1022.     LONG            Execute            ARGs(    (char *, BPTR, BPTR)                    );
  1023. #endif
  1024.  
  1025. /*
  1026.  ************************************************************************
  1027.  *    Now for the stuff that only exists in arp.library...        *
  1028.  ************************************************************************
  1029.  */
  1030.     LONG        C_Args    Printf            ARGs(    (char *,...)                        );
  1031.     LONG        C_Args    FPrintf            ARGs(    (BPTR, char *,...)                        );
  1032.     LONG            Puts             ARGs(    (char *)                        );
  1033.     LONG            Readline        ARGs(    (char *)                        );
  1034.     LONG            GADS             ARGs(    (char *, LONG, char *, char **, char *)            );
  1035.     LONG            Atol            ARGs(    (char *)                        );
  1036.     ULONG            EscapeString         ARGs(    (char *)                        );
  1037.     LONG            CheckAbort        ARGs(    (VOID(*))                        );
  1038.     LONG            CheckBreak        ARGs(    (LONG, VOID(*))                        );
  1039.     BYTE            *Getenv            ARGs(    (char *, char *, LONG)                    );
  1040.     BOOL            Setenv            ARGs(    (char *, char *)                    );
  1041.     BYTE            *FileRequest         ARGs(    (struct FileRequester *)                );
  1042.     VOID            CloseWindowSafely    ARGs(    (struct Window *, LONG)                    );
  1043. struct    MsgPort            *CreatePort        ARGs(    (const char *, LONG)                        );
  1044.     VOID            DeletePort         ARGs(    (struct MsgPort *)                    );
  1045.     LONG            SendPacket         ARGs(    (LONG, LONG *, struct MsgPort *)            );
  1046.     VOID            InitStdPacket        ARGs(    (LONG, LONG *, struct DosPacket *, struct MsgPort *)    );
  1047.     ULONG            PathName        ARGs(    (BPTR, char *,LONG)                    );
  1048.     ULONG            Assign            ARGs(    (char *, char *)                    );
  1049.     VOID            *DosAllocMem        ARGs(    (LONG)                            );
  1050.     VOID            DosFreeMem        ARGs(    (VOID *)                        );
  1051.     ULONG            BtoCStr            ARGs(    (char *, BSTR, LONG)                    );
  1052.     ULONG            CtoBStr            ARGs(    (char *, BSTR, LONG)                    );
  1053. struct    DeviceList        *GetDevInfo        ARGs(    (struct DeviceList *)                    );
  1054.     BOOL            FreeTaskResList        ARGs(    (VOID)                            );
  1055.     VOID            ArpExit         ARGs(    (LONG,LONG)                        );
  1056.     VOID        C_Args    *ArpAlloc        ARGs(    (LONG)                            );
  1057.     VOID        C_Args    *ArpAllocMem        ARGs(    (LONG, LONG)                        );
  1058.     BPTR        C_Args    ArpOpen            ARGs(    (char *, LONG)                        );
  1059.     BPTR        C_Args    ArpDupLock        ARGs(    (BPTR)                            );
  1060.     BPTR        C_Args    ArpLock            ARGs(    (char *, LONG)                        );
  1061.     VOID        C_Args    *RListAlloc        ARGs(    (struct ResList *, LONG)                );
  1062. struct    Process            *FindCLI        ARGs(    (LONG)                            );
  1063.     BOOL            QSort            ARGs(    (VOID *, LONG, LONG, int(*))                );
  1064.     BOOL            PatternMatch        ARGs(    (char *,char *)                        );
  1065.     LONG            FindFirst        ARGs(    (char *, struct AnchorPath *)                );
  1066.     LONG            FindNext        ARGs(    (struct AnchorPath *)                    );
  1067.     VOID            FreeAnchorChain        ARGs(    (struct AnchorPath *)                    );
  1068.     ULONG            CompareLock        ARGs(    (BPTR, BPTR)                        );
  1069. struct    ResList            *FindTaskResList    ARGs(    (VOID)                            );
  1070. struct    ResList            *CreateTaskResList    ARGs(    (VOID)                            );
  1071.     VOID            FreeResList        ARGs(    (struct ResList *)                    );
  1072.     VOID            FreeTrackedItem        ARGs(    (struct DefaultTracker *)                );
  1073. struct    DefaultTracker    C_Args    *GetTracker        ARGs(    (LONG)                            );
  1074.     VOID            *GetAccess        ARGs(    (struct DefaultTracker *)                );
  1075.     VOID            FreeAccess        ARGs(    (struct DefaultTracker *)                );
  1076.     VOID            FreeDAList        ARGs(    (struct DirectoryEntry *)                );
  1077. struct    DirectoryEntry        *AddDANode        ARGs(    (char *, struct DirectoryEntry **, LONG, LONG)        );
  1078.     ULONG            AddDADevs        ARGs(    (struct DirectoryEntry **, LONG)            );
  1079.     LONG            Strcmp            ARGs(    (char *, char *)                    );
  1080.     LONG            Strncmp            ARGs(    (char *, char *, LONG)                    );
  1081.     BYTE            Toupper            ARGs(    (BYTE)                            );
  1082.     LONG            SyncRun            ARGs(    (char *, char *, BPTR, BPTR)                );
  1083.  
  1084. /*
  1085.  ************************************************************************
  1086.  *    Added V32 of arp.library                    *
  1087.  ************************************************************************
  1088.  */
  1089.     LONG            ASyncRun        ARGs(    (char *, char *, struct ProcessControlBlock *)        );
  1090.     LONG            SpawnShell        ARGs(    (char *, char *, struct NewShell *)            );
  1091.     BPTR            LoadPrg            ARGs(    (char *)                        );
  1092.     BOOL            PreParse        ARGs(    (char *, char *)                    );
  1093.  
  1094. /*
  1095.  ************************************************************************
  1096.  *    Added V33 of arp.library                    *
  1097.  ************************************************************************
  1098.  */
  1099.     BOOL            StamptoStr        ARGs(    (struct DateTime *)                    );
  1100.     BOOL            StrtoStamp        ARGs(    (struct DateTime *)                    );
  1101. struct    ResidentProgramNode    *ObtainResidentPrg    ARGs(    (char *)                        );
  1102. struct    ResidentProgramNode    *AddResidentPrg        ARGs(    (BPTR, char *)                        );
  1103.     LONG            RemResidentPrg        ARGs(    (char *)                        );
  1104.     VOID            UnLoadPrg        ARGs(    (BPTR)                            );
  1105.     LONG            LMult            ARGs(    (LONG, LONG)                        );
  1106.     LONG            LDiv            ARGs(    (LONG, LONG)                        );
  1107.     LONG            LMod            ARGs(    (LONG, LONG)                        );
  1108.     ULONG            CheckSumPrg        ARGs(    (struct ResidentProgramNode *)                );
  1109.     VOID            TackOn            ARGs(    (char *, char *)                    );
  1110.     BYTE            *BaseName        ARGs(    (char *)                        );
  1111. struct    ResidentProgramNode    *ReleaseResidentPrg    ARGs(    (BPTR)                            );
  1112.  
  1113. /*
  1114.  ************************************************************************
  1115.  *    Added V36 of arp.library                    *
  1116.  ************************************************************************
  1117.  */
  1118.     LONG        C_Args    SPrintf            ARGs(    (char *, char *,...)                    );
  1119.     LONG            GetKeywordIndex        ARGs(    (char *, char *)                    );
  1120. struct    Library        C_Args    *ArpOpenLibrary        ARGs(    (char *, LONG)                        );
  1121. struct    FileRequester    C_Args    *ArpAllocFreq        ARGs(    (VOID)                            );
  1122.     LONG            ReadLine        ARGs(    (char *)                        );
  1123.  
  1124. /*
  1125.  ************************************************************************
  1126.  *    Check if we should do the pragmas...                *
  1127.  ************************************************************************
  1128.  */
  1129. #ifndef    __NO_PRAGMAS
  1130.  
  1131. #ifndef    PROTO_ARP_H
  1132. #include <proto/arp.h>
  1133. #endif /* PROTO_ARP_H */
  1134.  
  1135. #endif /* __NO_PRAGMAS */
  1136.  
  1137. #endif /* LIBRARIES_ARPBASE_H */
  1138.